package org.smr.ministore.micro.client;

import org.blade.utils.Pager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smr.ministore.entities.GoodsSpecificationGroupOrgan;
import org.smr.ministore.entities.vo.Assign2OrgansVO;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import feign.hystrix.FallbackFactory;


@Component
public class HystrixGoodsSpecificationGroupOrganClientFactory implements FallbackFactory<FeignGoodsSpecificationGroupOrganMicroServiceClient> {

    private static final Logger LOGGER = LoggerFactory.getLogger(HystrixGoodsSpecificationGroupOrganClientFactory.class);

    @Override
    public FeignGoodsSpecificationGroupOrganMicroServiceClient create(Throwable cause) {
        HystrixGoodsSpecificationGroupOrganClientFactory.LOGGER.info("fallback; reason was: {}", cause.getMessage());

        return new FeignGoodsSpecificationGroupOrganMicroServiceClient() {

            @Override
            public int batchSave(List<GoodsSpecificationGroupOrgan> entities) {
                return -1;
            }

            @Override
            public int batchModify(List<GoodsSpecificationGroupOrgan> entities) {
                return -1;
            }

            @Override
            public int save(GoodsSpecificationGroupOrgan entity) {
                return -1;
            }

            @Override
            public int updateById(GoodsSpecificationGroupOrgan id) {
                return -1;
            }

            @Override
            public GoodsSpecificationGroupOrgan queryById(Long id) {
                GoodsSpecificationGroupOrgan goodsSpecificationGroupOrgan = new GoodsSpecificationGroupOrgan();
                goodsSpecificationGroupOrgan.setId(-1L);
                return goodsSpecificationGroupOrgan;
            }

            @Override
            public int deleteById(Long id) {
                return -1;
            }

            @Override
            public Pager<GoodsSpecificationGroupOrgan> paginate(GoodsSpecificationGroupOrgan entity, Long pageSize, Long pageNum) {
                Pager<GoodsSpecificationGroupOrgan> pager = new Pager<GoodsSpecificationGroupOrgan>();
                return pager;
            }

            @Override
            public int deleteByIdLogical(Long id) {
                return -1;
            }

            @Override
            public List<GoodsSpecificationGroupOrgan> selectBy(Assign2OrgansVO assignee) {
                GoodsSpecificationGroupOrgan goodsSpecificationGroupOrgan = new GoodsSpecificationGroupOrgan();
                goodsSpecificationGroupOrgan.setId(-1L);
                return Arrays.asList(goodsSpecificationGroupOrgan);
            }

        };//Return end
    }
}